package com.example.shop_car_2208.db

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.example.shop_car_2208.entity.CarEntity
import com.example.shop_car_2208.entity.SelectResult

@Dao
interface OrderDao {
    @Insert(onConflict =  OnConflictStrategy.REPLACE)
    fun getAdd(carEntity: CarEntity)//新增订单
    @Update
    fun update(carEntity: CarEntity)//修改订单
    @Query("select * from `order`")
    fun query():List<CarEntity>//查询所有订单
    @Query("select * from `order` where status = :stauts")
    fun queryStatus(stauts:Int):List<CarEntity>//查询制定状态的订单
    //删除所有待下单的订单
    @Query("delete from `order` where status = 0")
    fun delete()

}